
Image m_imgAskSound;
Image m_imgSoundMenuIcon;
Sprite m_sprAskSound;


void UpdateSound(int mode) {
	if (mode == UpdateType.UPDATE) { 
		if (IsKeyPressed(GK_LEFT|DK_SOFT_LEFT)) {
			hasSound = hasSfx = true;
		}
		else if (IsKeyPressed(GK_RIGHT|DK_SOFT_RIGHT)) {
			hasSound = hasSfx = false;
		}
		else if (IsKeyPressed( DK_NUM5 | DK_PAD_MIDDLE)) {
			// call next State
			SwitchState(GameState.Splash);
		}				
	}
	
	if (mode == UpdateType.PAINT)
	{
		// s_g.setColor(c_black);
		// s_g.fillRect(0, 0, SCREEN_W, SCREEN_H);
		// s_g.setColor(c_red);
		// s_g.setFont(Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_BOLD, Font.SIZE_LARGE));
		//s_g.drawString("DO YOU WANT SOUND ?", 50, 50, Graphics.LEFT | Graphics.BOTTOM);
		if (m_imgOptionBG != null)
		{
			s_g.drawImage(m_imgOptionBG, 0, 0, Graphics.TOP|Graphics.LEFT);
		}
		fonts[1].drawString("DO YOU WANT SOUND?",SCREEN_W>>1,30,Graphics.HCENTER,s_g);
		if (m_imgSoundMenuIcon != null && m_imgAskSound != null)
		{	
			if (hasSound)
			{
				s_g.setColor(c_white);
				s_g.fillRect(40, 150, 85, 49);
				m_sprAskSound.setPosition(5, 70);
				m_sprAskSound.setFrame(1);
				m_sprAskSound.paint(s_g);				
				// s_g.setColor(c_red);
				// s_g.drawString("YES", 20, 310, Graphics.LEFT | Graphics.BOTTOM);
				// s_g.setColor(c_blue);
				// s_g.drawString("NO", 200, 310, Graphics.LEFT | Graphics.BOTTOM);
				fonts[1].drawString("YES",20,285,Graphics.LEFT,s_g);
				fonts[2].drawString("NO",200,285,Graphics.LEFT,s_g);
				s_g.drawImage(m_imgSoundMenuIcon, 30, 285, Graphics.LEFT | Graphics.BOTTOM);
			}
			else
			{
				m_sprAskSound.setPosition(10, 70);
				m_sprAskSound.setFrame(0);
				m_sprAskSound.paint(s_g);	
				// s_g.setColor(c_red);
				// s_g.drawString("NO", 200, 310, Graphics.LEFT | Graphics.BOTTOM);
				// s_g.setColor(c_blue);
				// s_g.drawString("YES", 20, 310, Graphics.LEFT | Graphics.BOTTOM);	
				fonts[1].drawString("NO",200,285,Graphics.LEFT,s_g);
				fonts[2].drawString("YES",20,285,Graphics.LEFT,s_g);
				s_g.drawImage(m_imgSoundMenuIcon, 200, 285, Graphics.LEFT | Graphics.BOTTOM);
			}
		}		
    }
	
	if (mode == UpdateType.CTOR)
	{
		try
		{
			m_imgAskSound = Image.createImage("/AskSound.png");
			m_imgSoundMenuIcon = Image.createImage("/iconSound.png");
			m_sprAskSound= new Sprite(m_imgAskSound, 240, 150);
			m_imgOptionBG = Image.createImage("/bg_pink_02.png");
		} 
		catch (Exception e)
		{
			System.out.println("Error loading Img AskSound -CTOR  e::::::::: " + e.getMessage());
		}
	}
	if(mode==UpdateType.DTOR)
	{
			m_imgAskSound = null;
			m_imgSoundMenuIcon = null;
			m_sprAskSound = null;
			m_imgOptionBG=null;
			System.gc();
	}
}
